package cn.hl.sfzy.service.impl;

import cn.hl.sfzy.entity.Chargetype;
import cn.hl.sfzy.mapper.ChargetypeMapper;
import cn.hl.sfzy.service.ChargetypeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Date 2024年10月23日
 */
//取消所有黄色警告
//@SuppressWarnings("all")
@Service
public class ChargetypeServiceImpl implements ChargetypeService {
    @Autowired
    private ChargetypeMapper chargetypeMapper;

    @Override
    public int add(Chargetype chargetype) {
        return chargetypeMapper.insert(chargetype);
    }

    @Override
    public int remove(Long[] id) {
        return chargetypeMapper.remove(id);
    }

    @Override
    public int edit(Chargetype chargetype) {
        return chargetypeMapper.updateByPrimaryKeySelective(chargetype);
    }

    public List<Chargetype> find(Chargetype chargetype) {
        return chargetypeMapper.find(chargetype);
    }

    @Override
    public PageInfo<Chargetype> findByPage(int pageNum, int pageSize, Chargetype chargetype) {
        PageHelper.startPage(pageNum, pageSize);
        List<Chargetype> chargetypes = chargetypeMapper.find(chargetype);
        return new PageInfo<>(chargetypes);
    }
}
